package com.bwie.parkdemo.mvvm.model;

import android.content.Context;

import com.bwie.lib_core.base.BaseEntity;
import com.bwie.lib_core.mvvm.base.BaseModel;
import com.bwie.lib_core.network.HttpRetrofitFactory;
import com.bwie.lib_core.network.HttpType;
import com.bwie.parkdemo.dao.LoginUserServe;
import com.bwie.parkdemo.mvvm.model.entity.LoginEntity;
import com.bwie.parkdemo.mvvm.model.entity.VisitorValuesEntity;

import io.reactivex.Observable;
import okhttp3.RequestBody;

public class VisitorValuesModel extends BaseModel {

    //请求来访预约详情
    @Override
    public Observable<BaseEntity> request(RequestBody... bodyes) {
        Observable<VisitorValuesEntity>requestValues =
                HttpRetrofitFactory.getInstance().factory(HttpType.TOKENINTERFACE)
                        .getRetrofit().create(Api.class).requestVisitorValues(bodyes[0]);
        return changeOB(requestValues);
    }

    //获取本地用户信息
    public LoginEntity.Values requestUser(Context ctx){
        return new LoginUserServe(ctx).selUser();
    }


    @Override
    public void cleared() {

    }
}
